// svelte.config.js
const sveltePreprocess = require('svelte-preprocess');
 
module.exports = {
  preprocess: sveltePreprocess({
    style: async ({ content, attributes, filename }) => {
        if (attributes.lang !== 'scss') return;

        const { css, stats } = await new Promise((resolve, reject) => sass.render({
            file: filename,
            data: content,
            includePaths: [
                dirname(filename),
            ],
        }, (err, result) => {
            if (err) reject(err);
            else resolve(result);
        }));

        return {
            code: css.toString(),
            dependencies: stats.includedFiles
        };
    }
  })
};